<?php
class language extends Model{
	public static function getTableName(){
		return 'language';
	}

	public static function getLanguageID($code)
	{
		#$sql = "select id from ".self::getTableName()." where code='{$code}'";
		#$ret = Model::$dbo['r']->findBySql(__class__, $sql);
		#return $ret[0]->id;

		$sql = 'select id from language where code=:code';
		$ret = Model::selectBySql($sql, array(':code'=>$code));
		return $ret[0]['id'];
	}

	/*
	 * by donald
	 * at 2011-10-12
	 */
	public static function getAll()
	{
		return self::$dbo['w']->findAll(__CLASS__);
	}

}
?>
